package org.jeecg.modules.compilation.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.compilation.dto.NoteFileDTO;
import org.jeecg.modules.compilation.entity.CiNote;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.compilation.dto.NotesDTO;

import java.util.List;
import java.util.Map;

/**
 * @Description: ci_note
 * @Author: jeecg-boot
 * @Date:   2024-03-15
 * @Version: V1.0
 */
public interface CiNoteMapper extends BaseMapper<CiNote> {
    @Select("SELECT document_title,document_sn,COUNT(*) as count FROM ci_note WHERE user_id = #{userId} GROUP BY document_title,document_sn")
    List<NotesDTO> selectFileNamesByUserId(@Param("userId") String userId);


    @Select("SELECT * FROM ci_note WHERE user_id = #{userId} AND document_sn = #{documentSn}")
    List<NoteFileDTO> selectFileNameAndCreateTime(@Param("userId") String userId, @Param("documentSn") String documentSn);
}
